package Thread;

import com.sun.org.apache.xpath.internal.objects.XObject;

import java.util.Scanner;

public class Dom24 {
    public static void main(String[] args) {
        Object object=new Object();
        Thread t1=new Thread(()->{
            try {
            System.out.println("wait之前。。");
            synchronized (object) {
                object.wait();
            }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            System.out.println("wait之后...");
        });
        Thread t2=new Thread(()->{
            Scanner scanner=new Scanner(System.in);
            System.out.println("输入任意内容。通知唤醒T1");
            scanner.nextInt();
            //notify  唤醒wait
           synchronized (object){
               object.notify();
           }
        });
            t1.start();
            t2.start();
    }
}
